home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Utilities / Content Creation Tool Plug-Ins / Maya / Sources / MayaInterface.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-09-27  |  7.0 KB  |  221 lines

  1. #ifndef __MAYAINTERFACE_H__
  2. #define __MAYAINTERFACE_H__
  3.  
  4. //required to compile under vc7
  5. //#define REQUIRE_IOSTREAM  
  6.  
  7.  
  8. //#define _XBOX_
  9.  
  10. #include "XExporter.h"
  11. #include "viewer.h"
  12.  
  13. #include <maya/MPxFileTranslator.h>
  14. #include <maya/MString.h>
  15.  
  16. #include <maya/MNodeMessage.h>
  17. #include <maya/MFileObject.h>
  18. #include <maya/MStatus.h>
  19. #include <maya/MPxNode.h>
  20. #include <maya/MArgList.h>
  21. #include <maya/MPxCommand.h>
  22. #include <maya/M3dView.h>
  23. #include <maya/MDagMessage.h>
  24. #include <maya/MSelectionList.h>
  25. #include <maya/MObjectArray.h>
  26.  
  27. #define DX_LONG_FXHANDLE            "DXCC_Fx_Handle"
  28. #define DX_SHORT_FXHANDLE            "DFxH"
  29. #define DX_LONG_FXFILE_NAME            "File"
  30. #define DX_SHORT_FXFILE_NAME        "DxFxFileName"
  31. #define DX_LONG_FXFILE_PATH            "DXCC_FxFile_Path"
  32. #define DX_SHORT_FXFILE_PATH        "DxFxFilePath"
  33. #define DX_LONG_FXPARAM_COUNT        "DXCC_FxParam_Count"
  34. #define DX_SHORT_FXPARAM_COUNT        "DxFxCount"
  35. #define DX_LONG_FXPARAM_NAME        "DXCC_FxParam_Name"
  36. #define DX_SHORT_FXPARAM_NAME        "DxFxName"
  37. #define DX_LONG_FXPARAM_DATA        "DXCC_FxParam_Data"
  38. #define DX_SHORT_FXPARAM_DATA        "DxFxData"
  39. #define DX_LONG_ATTRIB_CALLBACKID    "DXCC_NodeAttribute_CallbackID"
  40. #define DX_SHORT_ATTRIB_CALLBACKID    "DXca"
  41. #define DX_LONG_NAME_CALLBACKID        "DXCC_NodeName_CallbackID"
  42. #define DX_SHORT_NAME_CALLBACKID    "DXcn"
  43.  
  44.  
  45. #define MAKE_INPUT(attr)                                \
  46.     attr.setKeyable(false);  attr.setStorable(true);    \
  47.     attr.setReadable(true); attr.setWritable(true);
  48.  
  49. #define MAKE_OUTPUT(attr)                                \
  50.     attr.setKeyable(false); attr.setStorable(false);    \
  51.     attr.setReadable(true); attr.setWritable(false);
  52.  
  53. #define MAYA_FAILED(_stat)        ((_stat).error() ? (DXCC_DPFA_ERROR((_stat).errorString().asChar()), TRUE) : FALSE )
  54. #define MAYA_SUCCEEDED(_stat)    ((_stat).error() ? FALSE : TRUE )
  55.  
  56.  
  57. MString MakeNameExportable(MString &in);
  58.  
  59. //-----------------------------------------------------------------------------
  60. // Name: xfileTranslator (class)
  61. // Desc: An interface class for our Maya XFile Exporter
  62. //-----------------------------------------------------------------------------
  63. class XFileTranslator: public MPxFileTranslator 
  64. {
  65. public:
  66.     static void*        creator();
  67.     virtual                ~XFileTranslator ();    
  68.     virtual MStatus        reader(const MFileObject& file, const MString& optionsString, MPxFileTranslator::FileAccessMode mode);
  69.     virtual MStatus        writer(const MFileObject& file, const MString& optionsString, MPxFileTranslator::FileAccessMode mode);
  70.     virtual bool        haveReadMethod() const;
  71.     virtual bool        haveWriteMethod() const;
  72.     virtual MString     defaultExtension() const;
  73.     virtual MString     filter() const;
  74.     virtual MFileKind    identifyFile( const MFileObject& fileName, const char* buffer, short size) const;
  75. };
  76.  
  77.  
  78. class DirectXShader : public MPxNode, public IDXCCEffectDlgCallbacks
  79. {
  80. public:
  81.     DirectXShader(){};
  82.     virtual            ~DirectXShader(){};
  83.  
  84.  
  85.     STDMETHOD(OnPostLoad)(THIS_  
  86.          HWND hDialog, 
  87.          LPDIRECT3DDEVICE9 pDevice,
  88.          LPDXCCMANAGER pManager,
  89.          LPDXCCRESOURCE pResource,//recycle me
  90.          LPCSTR szNewEffectFilename);
  91.  
  92.     STDMETHOD(OnClose)(THIS_  
  93.          HWND hDialog, 
  94.          LPDIRECT3DDEVICE9 pDevice,
  95.          LPDXCCMANAGER pManager,
  96.          LPDXCCRESOURCE pResource);
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.     static  void *    creator();
  104.     virtual void    postConstructor(); 
  105.  
  106.     static  MStatus    initialize();
  107.  
  108.     virtual MStatus    compute( const MPlug&, MDataBlock& );
  109.     virtual bool    setInternalValue( const MPlug&, const MDataHandle&);
  110.  
  111.     static HANDLE    FxDialogEvent;
  112.  
  113.     //DXCC STATICS
  114.     static MObject  aDXCCCommand;
  115.     static MObject  aDXCCHandle;
  116.     //MAYA STATICS
  117.     static MTypeId  id;// The IFF type id
  118.     static MObject  aColor;// Surface color
  119.     static MObject  aColorR;// Red component of surface color
  120.     static MObject  aColorG;// Green component of surface color
  121.     static MObject  aColorB;// Blue component of surface color
  122.     static MObject  aOutColor;// Output color
  123.     static MObject  aOutColorR;// Red component of output color
  124.     static MObject  aOutColorG;// Green component of output color
  125.     static MObject  aOutColorB;// Blue component of output color
  126.     static MObject  aNormalCamera;// Surface normal
  127.     static MObject  aNormalCameraX;// X component of surface normal
  128.     static MObject  aNormalCameraY;// Y component of surface normal
  129.     static MObject  aNormalCameraZ;// Z component of surface normal
  130. };
  131.  
  132. class DXCCRebuildSceneCommand : public MPxCommand 
  133. {                            
  134. public:                                                            
  135.     DXCCRebuildSceneCommand() {};                                
  136.     virtual MStatus    doIt ( const MArgList& args);
  137.     static void*    creator(){ return new DXCCRebuildSceneCommand; }                                    
  138. };        
  139.  
  140. class DCCRebuildSelectedCommand : public MPxCommand 
  141. {                            
  142. public:                                                            
  143.     DCCRebuildSelectedCommand() {};                                
  144.     static void*    creator(){ return new DCCRebuildSelectedCommand; }                                    
  145.     virtual MStatus    doIt ( const MArgList& args);            
  146. };        
  147.  
  148. class DXCCExportSceneCommand : public MPxCommand 
  149. {                            
  150. public:                                                            
  151.     DXCCExportSceneCommand() {};                                
  152.     static void*    creator(){ return new DXCCExportSceneCommand; }                                    
  153.     virtual MStatus    doIt ( const MArgList& args);                
  154. };    
  155.  
  156. class DXCCExportSelectedCommand : public MPxCommand 
  157. {                            
  158. public:                                                            
  159.     DXCCExportSelectedCommand() {};                                
  160.     static void*    creator(){ return new DXCCExportSelectedCommand; }                                    
  161.     virtual MStatus    doIt ( const MArgList& args);        
  162. };    
  163.  
  164. class DXCCPreviewToggleCommand : public MPxCommand 
  165. {                            
  166. public:                                                            
  167.     DXCCPreviewToggleCommand() {};                                
  168.     static void*    creator(){ return new DXCCPreviewToggleCommand; }                                    
  169.     virtual MStatus    doIt ( const MArgList& args);                
  170. };    
  171.  
  172. class DXCCGatherAnimationCommand : public MPxCommand 
  173. {                            
  174. public:                                                            
  175.     DXCCGatherAnimationCommand() {};                                
  176.     static void*    creator(){ return new DXCCGatherAnimationCommand; }                                    
  177.     virtual MStatus    doIt ( const MArgList& args);                
  178. };    
  179.  
  180. class DXCCFrontViewCommand : public MPxCommand 
  181. {                            
  182. public:                                                            
  183.     DXCCFrontViewCommand() {};                                
  184.     static void*    creator(){ return new DXCCFrontViewCommand; }                                    
  185.     virtual MStatus    doIt ( const MArgList& args);            
  186. };    
  187.  
  188. class DXCCSideViewCommand : public MPxCommand 
  189. {                            
  190. public:                                                            
  191.     DXCCSideViewCommand() {};                                
  192.     static void*    creator(){ return new DXCCSideViewCommand; }                                    
  193.     virtual MStatus    doIt ( const MArgList& args);            
  194. };
  195.  
  196. class DXCCTopViewCommand : public MPxCommand 
  197. {                            
  198. public:                                                            
  199.     DXCCTopViewCommand() {};                                
  200.     static void*    creator(){ return new DXCCTopViewCommand; }                                    
  201.     virtual MStatus    doIt ( const MArgList& args);
  202. };
  203.  
  204. class DXCCPerspectiveViewCommand : public MPxCommand 
  205. {                            
  206. public:                                                            
  207.     DXCCPerspectiveViewCommand() {};                                
  208.     static void*    creator(){ return new DXCCPerspectiveViewCommand; }                                    
  209.     virtual MStatus    doIt ( const MArgList& args);        
  210. };
  211.  
  212. class DXCCFloatingViewCommand : public MPxCommand 
  213. {                            
  214. public:                                                            
  215.     DXCCFloatingViewCommand() {};                                
  216.     static void*    creator(){ return new DXCCFloatingViewCommand; }                                    
  217.     virtual MStatus    doIt ( const MArgList& args);
  218. };
  219.  
  220.  
  221. #endif //__MAYAINTERFACE_H__